package com.fhzn.auth.web.request;

import com.google.common.base.MoreObjects;
import lombok.*;

import javax.validation.constraints.NotEmpty;
import java.util.Collections;
import java.util.List;

/**
 * @author 老顾
 * @apiNote
 * @since 2023/12/28
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class UserRoleRequest extends BaseRequest {

    /**
     * 目标用户
     */
    @NotEmpty(message = "目标用户不能为空")
    private String targetUser;

    /**
     * 操作者
     */
    private String operatorUser;


    /**
     * 角色列表
     */
    @NotEmpty(message = "角色列表不能为空")
    private List<Integer> roleIds;


    @Override
    public UserRoleRequest genServiceParam() {
        return null;
    }

    public List<Integer> getRoleIds() {
        return MoreObjects.firstNonNull(roleIds, Collections.emptyList());
    }
}
